from multiprocessing import Process, Lock
#创建文件
f=open('result.log', 'a', encoding='utf-8')

class wash:
    wash_machine_price = 3000

def ggl(i, lock):
    #获得锁的使用权
    lock.acquire()
    w=wash()
    print(i)
    f.write(f'{w.wash_machine_price}\n')
    #释放锁
    lock.release()

if __name__ =="__main__":
    j_array=[]
    #创建锁
    lock = Lock()
    for i in range(200):
        p = Process(target=ggl, args=(i, lock))
        p.start()
        j_array.append(p)
    for j in j_array:
        j.join()
    print('jj')
